package com.kpijavatraining.module.io;


import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;

import com.kpijavatraining.module.Session;

/**
 * Class saves the TestStack in a file
 * @author Bogdan Olexandr
 *
 */
public class SystemSave{

	private OutputStream output;
	private ObjectOutputStream data;
		
	/**
	 * method saves the TestStack in a file
	 * @param session
	 * @throws java.io.IOException
	 */
	public void save(Session session) throws IOException {
		output = new FileOutputStream(session.getUser().toString()+".ucl");
		data = new ObjectOutputStream(output);
		data.writeObject(session);
		data.flush();
		data.close();
	}
}

